package com.zx1316.javadoudizhuserver;

public record Card(String content) implements Comparable<Card> {
    @Override
    public int compareTo(Card card) {
        int i = 0;
        while (!content.equals(GameThread.INIT_CARD[i])) {
            i++;
        }
        for (int j = 0; j < i; j++) {
            if (card.content().equals(GameThread.INIT_CARD[j])) {
                return -1;
            }
        }
        return 1;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Card card) {
            return content.equals(card.content());
        }
        return false;
    }
}
